<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>js操作class</title>
	<style type="text/css">
		.box{
			width: 200px;
			height: 200px;
			background-color: gold;
		}

		.box2{
			width: 300px;
			height: 300px;
			background-color: red;
		}
	</style>
	<script type="text/javascript">
		window.onload = function(){
			var oDiv1 = document.getElementById('div1');

			// “class” 属性写成 “className”
			oDiv1.className = 'box2'
		}
	</script>
</head>
<body>
	<div class="box" id="div1"></div>
</body>
</html>